package com.ykun.shiro.chapter6.service;

import com.ykun.shiro.chapter6.dao.RoleDao;
import com.ykun.shiro.chapter6.dao.RoleDaoImpl;
import com.ykun.shiro.chapter6.entity.Role;

/**
 * Created by yangkun on 2017/8/29.
 */
public class RoleServiceImpl implements RoleService {

    private RoleDao dao = new RoleDaoImpl();

    public Role createRole(Role role) {
        return dao.createRole(role);
    }

    public void deleteRole(Long roleId) {
        dao.deleteRole(roleId);
    }

    /**
     * 添加角色-权限之间关系
     * @param roleId
     * @param permissionIds
     */
    public void correlationPermissions(Long roleId, Long... permissionIds) {
        dao.correlationPermissions(roleId, permissionIds);
    }

    /**
     * 移除角色-权限之间关系
     * @param roleId
     * @param permissionIds
     */
    public void uncorrelationPermissions(Long roleId, Long... permissionIds) {
        dao.uncorrelationPermissions(roleId, permissionIds);
    }
}
